Skip to content

gh-51067: Rephrase doc for ZipFile.{remove,repack} - #151932

Open
danny0838 wants to merge 1 commit into
python:mainfrom
danny0838:gh-51067
Open

danny0838 wants to merge 1 commit into
python:mainfrom
danny0838:gh-51067

Conversation

@danny0838

@danny0838 danny0838 commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the reviewers for accepting PR #134627, this is a following slight rephrase of the documentation to make it more concise and readable.

@read-the-docs-community

read-the-docs-community Bot commented Jun 22, 2026 •

Copy link
Copy Markdown

@danny0838

Copy link
Copy Markdown
Contributor Author

@gpshead Would you like to check for this doc improvement?

Comment thread Doc/library/zipfile.rst
tools.

When *strict_descriptor* is true (the default), unsigned descriptors are
not detectable, and unreferenced entries using them are not recognized and

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Unsigned descriptors are not detectable" is wrong. They are detectable with strict_descriptor=False. They are just not detected by default. It should stay "are not detected". The code confirms this: the unsigned-descriptor fallback in _validate_local_file_entry runs only when not self.strict_descriptor

@danny0838 danny0838 Oct 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are detectable with strict_descriptor=False is same as the original sentence When *strict_descriptor* is true (the default) , unsigned descriptors are not detectable.

I prefer "not detectable" than "not detected" here since it better reflects the fact that unsigned descriptors cannot be detected by the scanning algorithm using the default arguments.

Comment thread Doc/library/zipfile.rst
:class:`ZipInfo` to :meth:`repack` to ensure the data is removed
regardless of how the entry was written.
forensically recoverable. To completely delete the data and reclaim
space, call :meth:`repack` afterwards (preferably passing the returned

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Preferably" undersells it. For entries written with unsigned descriptors, passing removed is the only way the default scan reclaims them, not just preference.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would you recommend, then?

After all, passing removed is not the only way to reclaim an entry with unsigned descriptor since it can also be done by passing strict_descriptor=False. So it is still the preferable rather than mandatory way.

If a stronger word is preferred, what about "prudently" or "advisably"?

Comment thread Doc/library/zipfile.rst
Comment on lines -610 to -611
tools; signed descriptors—written by Python and other modern tools—are always
detected. When *strict_descriptor* is true (the default), only signed data

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropping the claim that "signed descriptors are always detected" is unnecessarily removing reassurance that Python-written archives are unaffected.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree the argument but still don't like the original structure.

What about adding a note at the last of this paragraph? Such as:

Unsigned descriptors have been deprecated by the `PKZIP Application Note`_
since version 6.3.0 (released in 2006) and are rarely produced by modern
tools, and descriptors written by Python `zipfile` are always signed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants